<%@ page import="kioscodeal.User" %>



<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'login', 'error')} required">
	<label for="login">
		<g:message code="user.login.label" default="Login" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="login" required="" value="${userInstance?.login}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'password', 'error')} required">
	<label for="password">
		<g:message code="user.password.label" default="Password" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="password" required="" value="${userInstance?.password}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'nombre', 'error')} required">
	<label for="nombre">
		<g:message code="user.nombre.label" default="Nombre" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="nombre" required="" value="${userInstance?.nombre}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'apellido', 'error')} required">
	<label for="apellido">
		<g:message code="user.apellido.label" default="Apellido" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="apellido" required="" value="${userInstance?.apellido}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'calle', 'error')} required">
	<label for="calle">
		<g:message code="user.calle.label" default="Calle" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="calle" required="" value="${userInstance?.calle}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'numeroDireccion', 'error')} required">
	<label for="numeroDireccion">
		<g:message code="user.numeroDireccion.label" default="Numero" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="numeroDireccion" type="number" value="${userInstance.numeroDireccion}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'piso', 'error')} required">
	<label for="piso">
		<g:message code="user.piso.label" default="Piso" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="piso" type="number" value="${userInstance.piso}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'numeroDepartamento', 'error')} required">
	<label for="numeroDepartamento">
		<g:message code="user.numeroDepartamento.label" default="Numero Departamento" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="numeroDepartamento" type="number" value="${userInstance.numeroDepartamento}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'codigoPostal', 'error')} required">
	<label for="codigoPostal">
		<g:message code="user.codigoPostal.label" default="Codigo Postal" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="codigoPostal" type="number" value="${userInstance.codigoPostal}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'telefonoFijo', 'error')} required">
	<label for="telefonoFijo">
		<g:message code="user.telefonoFijo.label" default="Telefono Fijo" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="telefonoFijo" type="number" value="${userInstance.telefonoFijo}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'telefonoMovil', 'error')} required">
	<label for="telefonoMovil">
		<g:message code="user.telefonoMovil.label" default="Telefono Movil" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="telefonoMovil" type="number" value="${userInstance.telefonoMovil}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'mail', 'error')} required">
	<label for="mail">
		<g:message code="user.mail.label" default="E-Mail" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="email" name="mail" required="" value="${userInstance?.mail}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'dni', 'error')} required">
	<label for="dni">
		<g:message code="user.dni.label" default="DNI" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="dni" type="number" value="${userInstance.dni}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'edad', 'error')} required">
	<label for="edad">
		<g:message code="user.edad.label" default="Edad" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="edad" type="number" value="${userInstance.edad}" required=""/>
</div>


<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'fechaNacimiento', 'error')} required">
	<label for="fechaNacimiento">
		<g:message code="user.fechaNacimiento.label" default="Fecha Nacimiento" />
		<span class="required-indicator">*</span>
	</label>
	<g:datePicker name="fechaNacimiento" precision="day"  value="${userInstance?.fechaNacimiento}"  />
</div>

<g:if test="${session?.user?.role?.value == 'admin'}">
	<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'role', 'error')} required">
		<label for="role">
			<g:message code="user.role.label" default="Role" />
			<span class="required-indicator">*</span>
		</label>
		<g:select name="role" from="${kioscodeal.Role?.values()}" keys="${kioscodeal.Role.values()*.name()}" required="" value="${userInstance?.role?.name()}"/>
	</div>
	
	<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'minimoCompra', 'error')} required">
		<label for="minimoCompra">
			<g:message code="user.minimoCompra.label" default="Minimo Compra" />
			<span class="required-indicator">*</span>
		</label>
		<g:field name="minimoCompra" value="${fieldValue(bean: userInstance, field: 'minimoCompra')}" required=""/>
	</div>
	
	<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'estado', 'error')} required">
		<label for="estado">
			<g:message code="user.estado.label" default="Estado" />
			<span class="required-indicator">*</span>
		</label>
		<g:select name="estado" from="${kioscodeal.EstadoCliente?.values()}" keys="${kioscodeal.EstadoCliente.values()*.name()}" required="" value="${userInstance?.estado?.name()}"/>
	</div>
</g:if>